package io.renren.modules.matlist.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.utils.R;
import io.renren.modules.matlist.entity.MatlistEntity;
import io.renren.modules.matlist.entity.PalletmatEntity;
import io.renren.modules.matlist.service.MatlistService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("matlist/material")
public class MatlistController {
    @Autowired
    private MatlistService matlistService;

    /**
     * 列表
     */
//    @RequestMapping("/listMat")
//    public R list(@RequestParam Map<String, Object> params){
//        // PageUtils page = matlistService.queryPage(params);
//        // 分页
////        int pageIndex = Integer.parseInt(String.valueOf(params.get("page")));
////        int pageSize = Integer.parseInt(String.valueOf(params.get("limit")));
//        String pid = String.valueOf(params.get("key"));
////        Page<MatlistEntity> page = new Page<>(pageIndex,pageSize);
//
//        // 通过调用自定义dao层实现
//        matlistService.listMat(pid);
//        return R.ok();
//    }
    @GetMapping("listMat")
    public List<MatlistEntity> listMat(@RequestParam("pid") String pid){
        return matlistService.listMat(pid);
    }


    @GetMapping("listPileMat")
    public List<MatlistEntity> listPileMat(@RequestParam("pid") String pid){
        return matlistService.listPileMat(pid);
    }


    @GetMapping("pallet")
    public String listPallet(@RequestParam("palletCode") String palletCode){
        return matlistService.listPallet(palletCode);
    }
}
